package view;

import java.awt.Color;
import javax.swing.JScrollPane;
import static javax.swing.ScrollPaneConstants.*;
import controller.Controller;

public class BottomBar extends GamePanel {
	private static final long serialVersionUID = 1L;
	CommandPanel cp;
	InventoryPanel ip;
	JScrollPane sp;
	
	public BottomBar(Stage parent, Controller controller, int w, int h){
		super(parent, controller, w, h);
		init();
	}

	protected void init() {
		setLayout(null);
		setBackground(Color.darkGray);
		cp = new CommandPanel(parent, controller, this.getHeight() - 10, this.getHeight() - 10);
		cp.setLocation(this.getWidth() - this.getHeight() +5, 5);
		add(cp);
		
		ip = new InventoryPanel(parent, controller,  this.getWidth()*7/10, this.getHeight() - 10);
		ip.setLocation(5, 5);
		sp =  new JScrollPane(ip);
		sp.setBackground(Color.black);
		sp.getViewport().setBackground(Color.black);
		sp.setBounds(5, 5, this.getWidth()*7/10, this.getHeight() - 10);
		sp.setHorizontalScrollBarPolicy(HORIZONTAL_SCROLLBAR_NEVER);
		add(ip);
	}

	@Override
	protected void update() {
		cp.update();
		ip.update();
	}
}
